<template>
	<view class="page">
		<view class="top-box">
			<text>我的石榴果</text>
			<view class="content">
				<text>{{textVal}}</text>
				<view class="btn" @click="junit('/pages/prefile/supperBox/supperBox')">
					去使用
				</view>
			</view>
		</view>
		
		<view class="arrLabel">
			<text @click="changeArrType(0)" :class="params.status==0 ? 'activeText' : ''">明细</text>
			<view class="typeArr">
				<text :class="params.status==item.id ? 'activeText' : ''" v-for="(item,index) in typeArr" :key="index"  @click="changeArrType(item.id)">{{item.label}}</text>
			</view>
		</view>
		<scroll-view scroll-y @scrolltolower="scrolltolower" class="arr">
			<view class="arrItem" v-for="(item,index) in arr" :key="index">
				<view class="left-box">
					<view class="name">
						{{item.remark}}
					</view>
					<text>	
						{{item.updated_at}}
					</text>
				</view>
				<view class="price">
					{{item.change_value}}
				</view>
			</view>
			<noMore v-if="!arr.length"></noMore>
		</scroll-view>
		
	</view>
</template>

<script>
	import noMore from '@/components/noMore/noMore.vue'
	export default {
		data() {
			return {
				textVal:'',
				typeArr: [
					{
						label : '收入',
						id : 1, 
					},
					{
						label : '支出',
						id : 2, 
					},
				],
				arr:[],
				params:{
					page: 1,
					status : 0,
					// mid :  uni.getStorageSync('userInfo').uid,
				}
			}
		},
		onLoad() {
		},
		components:{
			noMore
		},
		onShow() {
			this.getMemberInfo()
			this.getDetailArr()
		},
		methods:{
			scrolltolower(){
				this.params.page++
				this.getDetailArr()
			},
			changeArrType(_id){
				this.params.status = _id
				this.params.page = 1
				this.getDetailArr()
			},
			getDetailArr(){
				this.myHttp({
					url:'/addons/yun_shop/api.php',
					data:{
						route : 'plugin.blind-box.frontend.credit.logs',
						income_type: this.params.status,
						page : this.params.page,
					}
				}).then((res)=>{
					if(res.result== '1'){
						if(this.params.page==1){
							this.arr = []
						}
						this.arr = this.arr.concat(res.data.data) 
						// this.activeArr = res.data.data
						// console.log(this.activeArr);
					}
				})
			},
			getMemberInfo(){
				this.myHttp({
					url:'/addons/yun_shop/api.php',
					data:{
						route : 'member.member.get-user-info',
					}
				}).then((res)=>{
					if(res.result== '1'){
						this.textVal =res.data.credit3
					}
				})
			},
		},
		components:{
			
		},
		filters:{
			
		},
	}
</script>

<style lang="scss" scoped>
.page{
	padding: 25rpx;
	font-family: PingFang SC;
	.top-box{
		width: 700rpx;
		height: 242rpx;
		background: linear-gradient(98deg, #E95E2A, #F0953E);
		border-radius: 20rpx;
		padding:46rpx 21rpx 0 44rpx ;
		text{
			font-size: 24rpx;
			color: #fff;
		}
		.content{
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-top: 10rpx;
			text{
				font-size: 72rpx;
				font-weight: bold;
				color: #FFFFFF;
			}
			.btn{
				width: 136rpx;
				height: 43rpx;
				border: 2rpx solid #FFFFFF;
				border-radius: 22rpx;
				display: grid;
				place-items: center;
				font-size: 24rpx;
				color: #fff;
			}
		}
	}
	.arrLabel{
		display: flex;
		justify-content: space-between;
		margin-top: 52rpx;
		.activeText{
			font-size: 30rpx;
			color: #010101;
		}
		
		text{
			color: #BCBCBC;
			margin-left: 83rpx;
			&:nth-child(1){
				margin-left: 0;
			}
		}
		.typeArr{
			display: flex;
			
		}
	}
	.arr{
		margin-top: 40rpx;
		height: 65vh;
		.arrItem{
			width: 700rpx;
			height: 126rpx;
			background: #FFFFFF;
			border-bottom: 2rpx solid #eee;
			border-radius: 10rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			.left-box{
				height: 100%;
				display: flex;
				flex-direction: column;
				justify-content: center;
				.name{
					margin-bottom: 21rpx;
					font-size: 28rpx;
					color: #000;
				}
			}
			.price{
				color: #000;
				font-weight: 600;
				font-size: 33rpx;
			}
		}
	}
}
</style>
